package com.jintian.smart.kernel.orm.dto;

import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.databind.ObjectMapper;

import lombok.Data;

@Data
public class EntityChangeLog<T> {
	private List<T> insert;
	private List<T> update;
	private List<T> template;
	private List<T> delete;
	private List<Cascade> cascades;

	public static EntityChangeLog<?> valueOf(Map<String, Object> request, Class<?> entityClass,
			ObjectMapper objectMapper) {
		EntityChangeLog<?> ret = objectMapper.convertValue(request,
				objectMapper.getTypeFactory().constructParametricType(EntityChangeLog.class, entityClass));
		return ret;
	}
}
